package com.kirk.cts.core.event;

/**
 * <p> CrawlerToolEventType.java </p>
 *
 * @version 1.0.0
 * @Author kirkliu
 * @Date 2020-08-31 19:19
 * @Description 事件类型
 */
public enum CrawlerToolEventType {
    /**
     * 采集规则Event.
     */
    NoTableChangeEvent, RuleTableChangeEvent, RuleTableAddEvent, RuleTableUpdateEvent, RuleTableDeleteEvent,
    /**
     * 本地采集规则Event.
     */
    LocalRuleTableChangeEvent, LocalRuleTableAddEvent, LocalRuleTableUpdateEvent, LocalRuleTableDeleteEvent,
    /**
     * 全站扫描规则Event.
     */
    ScanRuleTableChangeEvent, ScanRuleTableAddEvent, ScanRuleTableUpdateEvent, ScanRuleTableDeleteEvent,
    /**
     * 采集历史Event.
     */
    RuleHistoryTableChangeEvent, RuleHistoryTableAddEvent, RuleHistoryTableUpdateEvent, RuleHistoryTableDeleteEvent,
    /**
     * 采集内容Event.
     */
    ContentTableChangeEvent, ContentTableAddEvent, ContentTableUpdateEvent, ContentTableDeleteEvent,
    /**
     * 采集内容评论Event.
     */
    ContentCommentTableChangeEvent, ContentCommentTableAddEvent, ContentCommentTableUpdateEvent, ContentCommentTableDeleteEvent,
    /**
     * 采集内容分页Event.
     */
    ContentPaginationTableChangeEvent, ContentPaginationTableAddEvent, ContentPaginationTableUpdateEvent, ContentPaginationTableDeleteEvent,
    /**
     * 采集内容资源Event.
     */
    ContentResourceTableChangeEvent, ContentResourceTableAddEvent, ContentResourceTableUpdateEvent, ContentResourceTableDeleteEvent,
    /**
     * 采集扩展字段Event.
     */
    ContentExtendFieldChangeEvent, ContentExtendFieldAddEvent, ContentExtendFieldUpdateEvent, ContentExtendFieldDeleteEvent,
    /**
     * 采集任务Event.
     */
    TaskStatusChangeEvent, TaskStartEvent, TaskFinishedEvent,
    /**
     * 入库任务Event.
     */
    SaveStatusChangeEvent, SaveStartEvent, SaveFinishedEvent,
    /**
     * FTP上传任务Event.
     */
    FtpStatusChangeEvent, FtpStartEvent, FtpFinishedEvent,
    /**
     * 图片处理任务Event.
     */
    DealWithImageStatusChangeEvent, DealWithImageStartEvent, DealWithImageFinishedEvent,
    /**
     * 数据处理任务Event.
     */
    DataHandleStatusChangeEvent, DataHandleStartEvent, DataHandleFinishedEvent,
    /**
     * 加载图片任务Event.
     */
    LoadImagesChangeEvent, DeleteImagesChangeEvent,
    /**
     * 监控Event.
     */
    ProgressChangeEvent,
    /**
     * 数据库信息Event.
     */
    DataBaseTableChangeEvent, DataBaseTableAddEvent, DataBaseTableUpdateEvent, DataBaseTableDeleteEvent,
    /**
     * 系统配置信息Event.
     */
    ConfigTableChangeEvent, ConfigTableAddEvent, ConfigTableUpdateEvent, ConfigTableDeleteEvent,
    /**
     * 定时任务配置信息Event.
     */
    SchedulerTableChangeEvent, SchedulerTableAddEvent, SchedulerTableUpdateEvent, SchedulerTableDeleteEvent, SchedulerTableExecuteEvent, SchedulerTableStopEvent,
    /**
     * 数据校验
     */
    ValidDataChangeEvent,
    /**
     * 加载缓存
     */
    CacheDataChangeEvent, CacheConfigChangeEvent,
    /**
     * 系统启动
     */
    SystemSatrtChangeEvent, SystemSpringInitComplateEvent,
    /**
     * 系统更新
     */
    SystemVersionDownloadComplateEvent,
    /**
     * 系统退出
     */
    SystemExitChangeEvent,
    XEventType;

    public boolean isAlso(CrawlerToolEventType aEventType) {
        if (aEventType == CrawlerToolEventType.RuleTableChangeEvent) {
            switch (this) {
                case RuleTableChangeEvent:
                    return true;
                case RuleTableAddEvent:
                    return true;
                case RuleTableUpdateEvent:
                    return true;
                case RuleTableDeleteEvent:
                    return true;
                default:
                    return false;
            }
        }
        if (aEventType == CrawlerToolEventType.LocalRuleTableChangeEvent) {
            switch (this) {
                case LocalRuleTableChangeEvent:
                    return true;
                case LocalRuleTableAddEvent:
                    return true;
                case LocalRuleTableUpdateEvent:
                    return true;
                case LocalRuleTableDeleteEvent:
                    return true;
                default:
                    return false;
            }
        }
        if (aEventType == CrawlerToolEventType.ScanRuleTableChangeEvent) {
            switch (this) {
                case ScanRuleTableChangeEvent:
                    return true;
                case ScanRuleTableAddEvent:
                    return true;
                case ScanRuleTableUpdateEvent:
                    return true;
                case ScanRuleTableDeleteEvent:
                    return true;
                default:
                    return false;
            }
        }
        if (aEventType == CrawlerToolEventType.TaskStatusChangeEvent) {
            switch (this) {
                case TaskStatusChangeEvent:
                    return true;
                case TaskFinishedEvent:
                    return true;
                case TaskStartEvent:
                    return true;
                default:
                    return false;
            }
        }
        if (aEventType == CrawlerToolEventType.DataBaseTableChangeEvent) {
            switch (this) {
                case DataBaseTableChangeEvent:
                    return true;
                case DataBaseTableAddEvent:
                    return true;
                case DataBaseTableUpdateEvent:
                    return true;
                case DataBaseTableDeleteEvent:
                    return true;
                default:
                    return false;
            }
        }
        if (aEventType == CrawlerToolEventType.ConfigTableChangeEvent) {
            switch (this) {
                case ConfigTableChangeEvent:
                    return true;
                case ConfigTableAddEvent:
                    return true;
                case ConfigTableUpdateEvent:
                    return true;
                case ConfigTableDeleteEvent:
                    return true;
                default:
                    return false;
            }
        }

        if (aEventType == CrawlerToolEventType.SchedulerTableChangeEvent) {
            switch (this) {
                case SchedulerTableChangeEvent:
                    return true;
                case SchedulerTableAddEvent:
                    return true;
                case SchedulerTableUpdateEvent:
                    return true;
                case SchedulerTableDeleteEvent:
                    return true;
                case SchedulerTableExecuteEvent:
                    return true;
                case SchedulerTableStopEvent:
                    return true;
                default:
                    return false;
            }
        }
        return false;
    }

}
